#include <iostream>
#include <list>
#include "windows.h"
#include "q1.h"
#include "q2.h"
#include "q3.h"
#include "q4.h"
#include "baseline.h"
#include "baseline2.h"
#ifndef STRUCTURES
#define STRUCTURES
#include "structures.h"
#endif

using namespace std;

int main(int argc, char* argv[]){
	cout << "OS Design - Project 1" << endl << "Kevin Preheim" << endl << "Chris Williams" << endl << endl;

	// remove any existing output files
	remove("question1_output.txt"); remove("baseline1_output.txt");
	remove("question2_output.txt"); remove("baseline2_output.txt");
	remove("question3_output.txt"); remove("baseline3_output.txt");
	remove("question4_output.txt"); remove("baseline4_output.txt");
	remove("question5_output.txt"); remove("baseline5_output.txt");

	// average the results for 50 runs
	for(int i = 0; i < 50; i++){
		cout << i*2 << "% done" << endl;

		// generate random processes
		list<Structures::process> randomProcesses = Structures::generateProcesses(50);

		// instantiate objects
		//Q1 q1(randomProcesses);
		Baseline2 BL2(randomProcesses);
		Q2 q2(randomProcesses);
		//Q3 q3(randomProcesses);
		//Q4 q4(randomProcesses);

		// schedule processes
		//q1.baseline(); q1.schedule(); q1.print();
		BL2.schedule(); BL2.print();
		q2.schedule(); q2.print();
		//q3.baseline(); q3.schedule(); q3.print();
		//q4.baseline(); q4.schedule(); q4.print();
		Sleep(1000);
	}

	// pause at end
	cout << "Finished. Press enter to quit..." << endl;
	char x[1];
	cin.getline(x, 1);

	return 0;
}